package com.zhuiyun.project.api.appusercancel.mapper;

import com.zhuiyun.project.api.appusercancel.entity.userCancellation;
import com.zhuiyun.project.api.appusercancel.entity.userRecovery;
import com.zhuiyun.project.api.appusercancel.model.userCancelModel;
import com.zhuiyun.project.common.mapper.BaseMapper;
import com.zhuiyun.project.util.pageUtil.PageRequest;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AppUserCancelMapper extends BaseMapper<userCancellation> {

    /**
     * 查询注销的用户的信息
     * @author 温
     * @date 2023/6/22 10:51
     * @parameter [userName, pageRequest]
     * @return java.util.List<com.zhuiyun.project.api.appusercancel.entity.userCancellation>
     */
    @Select("select * from user_cancellation aa\n" +
            "left join app_user bb\n" +
            "on aa.cancellation_id=bb.id " +
            "where user_name like '%${userName}%'")
    List<userCancelModel>userCancelList(@Param("userName")String userName, @Param("PageRequest") PageRequest pageRequest);



    /**
     * 彻底删除注销的用户
     * @author 温
     * @date 2023/7/12 17:21
     * @parameter [cancellationId]
     * @return int
     */
    @Delete("delete from user_cancellation where cancellation_id=#{cancellationId}")
    int CancelDelete(int cancellationId);

    @Delete("delete from app_user where id=#{cancellationId}")
    int UserDelete(int cancellationId);


}
